<script setup lang="ts">
import {
  ElDropdown,
  ElDropdownMenu,
  ElDropdownItem,
  ComponentSize,
} from "element-plus";
import { MyIcon } from "@/components/MyIcon";
import { useAppStore } from "@/store/modules/app";
import { computed } from "vue";
const appStore = useAppStore();
const { getSizeMap } = appStore;
const sizeMap = computed(() => getSizeMap);
const changeSize = (size: ComponentSize) => {
  // console.log(size);
  appStore.setCurrentSize(size);
  // console.log(appStore.getCurrentSize);
};
</script>

<template>
  <el-dropdown trigger="click" style="cursor:pointer;" class="dropdown" @command="changeSize">
    <span class="el-dropdown-link">
      <MyIcon icon="size" size="20px" />
    </span>
    <template #dropdown>
      <el-dropdown-menu>
        <el-dropdown-item v-for="item in sizeMap" :command="item">
          {{ $t(`size.${item}`) }}
        </el-dropdown-item>
      </el-dropdown-menu>
    </template>
  </el-dropdown>
</template>
<style scoped lang="less"></style>
